package com.aube.interact.model;

import java.io.Serializable;

/**
 * 一个图片对象
 * 
 * @author huyn
 * 
 */
public class ImageItem implements Serializable {

	public int width;
	public int height;
	public int x,y;
	
    public ImageItem() {
	}
	
	public ImageItem(int w, int h, int x, int y) {
		width = w;
		height = h;
		this.x = x;
		this.y = y;
	}

	public ImageItem(float w, float h, float x, float y) {
		width = (int) w;
		height = (int) h;
		this.x = (int) x;
		this.y = (int) y;
	}

	public void resize(ImageItem item) {
		width = item.width;
		height = item.height;
		this.x = item.x;
		this.y = item.y;
	}

	public void update(float x, float y) {
		this.x = (int) x;
		this.y = (int) y;
	}

	public void updateDelta(float x, float y) {
		this.x += x;
		this.y += y;
	}

	public void updateY(float y) {
		this.y = (int) y;
	}

	public void update(float x, float y, int width, int height) {
		this.width = width;
		this.height = height;
		this.x = (int) x;
		this.y = (int) y;
	}

	public ImageItem copy() {
		return new ImageItem(width, height, x, y);
	}

}
